/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vetAdmin.util;

import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
import vetAdmin.dao.implementation.CombosClienteDAOJDBC;

/**
 *
 * @author gtaulamet
 */
public class ProvinciasModel extends AbstractListModel implements ComboBoxModel{

    
    private String[] items = null;
    private String seleccionado = null;

    public ProvinciasModel() throws Exception {
        items=CombosClienteDAOJDBC.getProvincias(AdministradorDeConexiones.getConnection());
        seleccionado = items[0];
    }     
    @Override
    public int getSize() {
        return items.length;
    }

    @Override
    public Object getElementAt(int index) {
        return items[index];
    }

    @Override
    public void setSelectedItem(Object anItem) {
        seleccionado = (String)anItem;
    }

    @Override
    public Object getSelectedItem() {
        return seleccionado;
    }
    
}